import { PagedSettingsContainer } from "@/src/components/PagedSettingsContainer"; import Header from "@/src/components/layouts/header"; import { MembershipInvitesPage } from "@/src/features/rbac/components/MembershipInvitesPage"; import { MembersTable } from "@/src/features/rbac/components/MembersTable"; import { JSONView } from "@/src/components/ui/CodeJsonViewer"; import RenameOrganization from "@/src/features/organizations/components/RenameOrganization"; import { useQueryOrganization } from "@/src/features/organizations/hooks"; import { useRouter } from "next/router"; import { SettingsDangerZone } from "@/src/components/SettingsDangerZone"; import { DeleteOrganizationButton } from "@/src/features/organizations/components/DeleteOrganizationButton"; import { BillingSettings } from "@/src/ee/features/billing/components/BillingSettings"; import { useHasEntitlement, usePlan } from "@/src/features/entitlements/hooks"; import ContainerPage from "@/src/components/layouts/container-page"; import { SSOSettings } from "@/src/ee/features/sso-settings/components/SSOSettings"; import { isCloudPlan } from "@langfuse/shared"; import { useQueryProjectOrOrganization } from "@/src/features/projects/hooks"; import { ApiKeyList } from "@/src/features/public-api/components/ApiKeyList"; import AIFeatureSwitch from "@/src/features/organizations/components/AIFeatureSwitch"; import { useIsCloudBillingAvailable } from "@/src/ee/features/billing/utils/isCloudBilling"; import { env } from "@/src/env.mjs"; import { OrgAuditLogsSettingsPage } from "@/src/ee/features/audit-log-viewer/OrgAuditLogsSettingsPage"; type OrganizationSettingsPage = { title: string; slug: string; show?: boolean | (() => boolean); cmdKKeywords?: string[]; } & ({ content: React.ReactNode } | { href: string }); export function useOrganizationSettingsPages(): OrganizationSettingsPage[] { const { organization } = useQueryProjectOrOrganization(); const showBillingSettings = useHasEntitlement("cloud-billing"); const showOrgApiKeySettings = useHasEntitlement("admin-api"); const showAuditLogs = useHasEntitlement("audit-logs"); const plan = usePlan(); const isLangfuseCloud = isCloudPlan(plan) ?? false; const isCloudBillingAvailable = useIsCloudBillingAvailable(); if (!organization) return []; return getOrganizationSettingsPages({ organization, showBillingSettings: showBillingSettings && isCloudBillingAvailable, showOrgApiKeySettings, showAuditLogs, isLangfuseCloud, }); } export const getOrganizationSettingsPages = ({ organization, showBillingSettings, showOrgApiKeySettings, showAuditLogs, isLangfuseCloud, }: { organization: { id: string; name: string; metadata: Record }; showBillingSettings: boolean; showOrgApiKeySettings: boolean; showAuditLogs: boolean; isLangfuseCloud: boolean; }): OrganizationSettingsPage[] => [ { title: "General", slug: "index", cmdKKeywords: ["name", "id", "delete"], content: (
, }, ]} />
), }, { title: "API Keys", slug: "api-keys", content: (
), show: showOrgApiKeySettings, }, { title: "Members", slug: "members", cmdKKeywords: ["invite", "user", "rbac"], content: (
), }, { title: "Audit Logs", slug: "audit-logs", cmdKKeywords: ["audit", "logs", "history", "changes"], content: , show: showAuditLogs, }, { title: "Billing", slug: "billing", cmdKKeywords: ["payment", "subscription", "plan", "invoice"], content: , show: showBillingSettings, }, { title: "SSO", slug: "sso", cmdKKeywords: ["sso", "login", "auth", "okta", "saml", "azure"], content: , show: isLangfuseCloud, }, { title: "Projects", slug: "projects", href: `/organization/${organization.id}`, }, ]; const OrgSettingsPage = () => { const organization = useQueryOrganization(); const router = useRouter(); const { page } = router.query; const pages = useOrganizationSettingsPages(); if (!organization) return null; return ( ); }; export default OrgSettingsPage;